import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/black_entity.dart';

BlackEntity $BlackEntityFromJson(Map<String, dynamic> json) {
  final BlackEntity blackEntity = BlackEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    blackEntity.total = total;
  }
  final List<BlackRows>? rows = (json['rows'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<BlackRows>(e) as BlackRows).toList();
  if (rows != null) {
    blackEntity.rows = rows;
  }
  final bool? success = jsonConvert.convert<bool>(json['success']);
  if (success != null) {
    blackEntity.success = success;
  }
  return blackEntity;
}

Map<String, dynamic> $BlackEntityToJson(BlackEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['rows'] = entity.rows.map((v) => v.toJson()).toList();
  data['success'] = entity.success;
  return data;
}

extension BlackEntityExtension on BlackEntity {
  BlackEntity copyWith({
    int? total,
    List<BlackRows>? rows,
    bool? success,
  }) {
    return BlackEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows
      ..success = success ?? this.success;
  }
}

BlackRows $BlackRowsFromJson(Map<String, dynamic> json) {
  final BlackRows blackRows = BlackRows();
  final String? accountNum = jsonConvert.convert<String>(json['AccountNum']);
  if (accountNum != null) {
    blackRows.accountNum = accountNum;
  }
  final String? reason = jsonConvert.convert<String>(json['Reason']);
  if (reason != null) {
    blackRows.reason = reason;
  }
  final String? createTime = jsonConvert.convert<String>(json['CreateTime']);
  if (createTime != null) {
    blackRows.createTime = createTime;
  }
  return blackRows;
}

Map<String, dynamic> $BlackRowsToJson(BlackRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['AccountNum'] = entity.accountNum;
  data['Reason'] = entity.reason;
  data['CreateTime'] = entity.createTime;
  return data;
}

extension BlackRowsExtension on BlackRows {
  BlackRows copyWith({
    String? accountNum,
    String? reason,
    String? createTime,
  }) {
    return BlackRows()
      ..accountNum = accountNum ?? this.accountNum
      ..reason = reason ?? this.reason
      ..createTime = createTime ?? this.createTime;
  }
}